<template>
	<view class="container flex-column-center">
		<image class="image" :src="$setting.imageUrl()+'finish.png'"></image>
		<view class="title">合作信息提交成功</view>
		<wx-open-launch-weapp id="launch-btn" appid="wx33c102deda4da799" username="gh_43146c3cb658"
			path="pages/index/index" v-if="environment == 'wechat'">
			<script v-is="'script'" type="text/wxtag-template">
				<style v-is="'style'">
					.btn {
						background: rgb(187, 0, 36);
						width: 315px;
						height: 45px;
						color: rgb(255, 255, 255);
						border: 1px solid rgb(187, 0, 36);
						font-size: 14px;
						overflow: visible;
						border-radius: 50px;
					}
				</style>
				<button	class="btn">返回酒秒达</button>
			</script>
		</wx-open-launch-weapp>
		<b-u-button-theme width="630rpx" height="90rpx" @click="send" v-if="environment == 'miniprogram'">返回酒秒达</b-u-button-theme>
	</view>
</template>

<script>
	var jweixin = require('@/common/jweixin.js');

	export default {
		data() {
			return {
				environment: 'mobile',
			}
		},
		onLoad() {
			if (this.isWechat()) {
				this.environment = "wechat";
			}
			jweixin.miniProgram.getEnv((res) => {
				// console.log(res) // true
				if (res.miniprogram) {
					this.environment = "miniprogram";
				}
			})
			// this.getHttp();
		},
		methods: {
			send() {
				jweixin.miniProgram.switchTab({
					url: "/pages/index/index"
				})
			},
			
			isWechat() {
				var ua = navigator.userAgent.toLowerCase()
				var isWXWork = ua.match(/wxwork/i) == 'wxwork'
				var isWeixin = !isWXWork && ua.match(/MicroMessenger/i) == 'micromessenger'
				return isWeixin;
			},
			getHttp() {
				
			},
		},
	}
</script>

<style lang="scss" scoped>
	.container {

		.image {
			margin-top: -300rpx;
			width: 300rpx;
			height: 300rpx;
		}

		.title {
			margin: 30rpx 0 80rpx 0;
		}
	}
</style>